using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace Decav.Gatsb.Application.Configuration
{
    /// <summary>
    /// Configures the Gatsb service application instance.
    /// </summary>
    public class GatsbApplicationConfigurationSection : ConfigurationSection
    {
        /// <summary>
        /// Gets the configuration section.
        /// </summary>
        public static GatsbApplicationConfigurationSection Current
        {
            get
            {
                return (GatsbApplicationConfigurationSection)ConfigurationManager.GetSection("decav.gatsb.application");
            }
        }

        /// <summary>
        /// Gets the location where incoming mail will be dropped.
        /// </summary>
        [ConfigurationProperty("mailDropPath", IsRequired = true)]
        public string MailDropPath
        {
            get
            {
                return (string)this["mailDropPath"];
            }
        }

        /// <summary>
        /// Gets the path to where the help text file is stored.
        /// </summary>
        [ConfigurationProperty("helpTextPath", IsRequired = true)]
        public string HelpTextPath
        {
            get
            {
                return (string)this["helpTextPath"];
            }
        }

        /// <summary>
        /// Gets the location where mail that could not be parsed will be dropped.
        /// </summary>
        [ConfigurationProperty("badMailPath", IsRequired = true)]
        public string BadMailPath
        {
            get
            {
                return (string)this["badMailPath"];
            }
        }

        [ConfigurationProperty("commands")]
        [ConfigurationCollection(typeof(CommandConfigurationCollection))]
        public CommandConfigurationCollection Commands
        {
            get
            {
                return (CommandConfigurationCollection)this["commands"];
            }
        }

        /// <summary>
        /// Gets the SQL Connection stirng to the workflow persistence database.
        /// </summary>
        [ConfigurationProperty("workflowSqlConnectionString", IsRequired = true)]
        public string WorkflowSqlConnectionString
        {
            get
            {
                return (string)this["workflowSqlConnectionString"];
            }
        }
    }
}
